/**TODO - Make more abstract. Allow different DataSources to be used for different DBMS */
package org.icosagon.datastore.sql;

import org.h2.jdbcx.JdbcDataSource;
import org.icosagon.datastore.DataStore;
import org.icosagon.datastore.SpellManager;

/**
 *
 */
public class SQLDataStore implements DataStore {
    /** User name used to connect to the database. **/
    private String user_name = "";
    /** Password used to connect to the database. **/
    private String pass_word = "";

    private JdbcDataSource ds = new JdbcDataSource();

    public SQLDataStore() {
    }

    /**
     * Connects this object to a database.
     * @param location - The location of the database. Uses the jdbc
     * URL schema.
     */
    public void connect(String location) {
        ds.setURL(location);
        ds.setUser(this.user_name);
    }

    public SpellManager getSpellManager() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setUserName(String name) {
        if(name == null)
            name = "";
        this.user_name = name;
    }

    public void setPassword(String password) {
        if(password == null)
            password = "";
        this.pass_word = password;
    }
}